<!-- 这里是首页活动展示 公益事项和加入我们宣传 -->
<template>
  <div
    id="activity"
    :style="{
      background: `url(${props.data.cover})`,
      backgroundRepeat: 'no-repeat',
      backgroundSize: 'cover',
      backgroundAttachment: 'fixed'
    }"
  >
    <!-- 暖心行动与爱同行 -->
    <template v-if="props.type === 0">
      <!-- 毛玻璃 -->
      <div class="vague"></div>
      <!-- 内容区域 -->
      <div class="conter">
        <div class="conter-left">
          <div class="content">
            <div class="tit">{{ props.data.title }}</div>
            <div class="titE">{{ props.data.titE }}</div>
            <div class="des">
              {{ props.data.des }}
            </div>
            <a class="more" href="/welfare">
              了解更多
              <i class="iconfont icon-xiangyou1"></i>
            </a>
          </div>
        </div>
        <div class="conter-right">
          <img :src="props.data.cover" alt="" />
        </div>
      </div>
    </template>
    <template v-else>
      <div class="activity_right">
        <!-- 背景红 -->
        <div class="bgc"></div>
        <!-- 毛玻璃 -->
        <div class="vague"></div>
        <!-- 内容区域 -->
        <div class="conter">
          <div class="conter-right">
            <img :src="props.data.cover" alt="" />
          </div>
          <div class="conter-left">
            <div class="content">
              <div class="tit">{{ props.data.title }}</div>
              <div class="titE">{{ props.data.titE }}</div>
              <div class="des">
                {{ props.data.des }}
              </div>
              <a class="more" href="/about">
                了解更多
                <i class="iconfont icon-xiangyou1"></i>
              </a>
            </div>
          </div>
        </div>
      </div>
    </template>
  </div>
</template>

<script lang="ts" setup>
import { defineProps } from 'vue'

interface Props {
  type: number
  data: {
    title: string
    titE: string
    des: string
    cover: string
  }
}

// 获取传入的数据
const props = defineProps<Props>()
</script>

<style scoped lang="less">
#activity {
  height: 769px;
  position: relative;
  .vague {
    background-color: rgba(0, 0, 0, 0);
    backdrop-filter: blur(6px);
    position: absolute;
    width: 100%;
    height: 769px;
    top: 0;
    left: 0;
    z-index: 1;
  }
  .conter {
    width: 1200px;
    height: 590px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    position: absolute;
    z-index: 10;
    display: flex;
    overflow: hidden;
    &:hover {
      .conter-left {
        .content {
          margin-left: 80px;
          .des {
            color: #ffffff;
          }
          .more {
            margin-left: 0px;
          }
        }
      }
      .conter-right {
        img {
          transform: scale(1.1);
        }
      }
    }
    .conter-left {
      background-color: rgba(241, 58, 58, 0.7);
      width: 1100px;
      .content {
        width: 475px;
        margin-top: 150px;
        margin-left: 60px;
        color: #fff;
        position: relative;
        transition: all 0.3s;
        .tit {
          font-size: 26px;
          font-family: '宋体';
          font-weight: 600;
        }
        .titE {
          font-size: 14px;
          margin: 20px 0 30px;
        }
        .des {
          font-size: 14px;
          line-height: 2.5em;
          font-family: '微软雅黑';
          color: #ffffffc5;
          transition: all 0.3s;
        }
        .more {
          width: 146px;
          height: 50px;
          background-color: #fff;
          cursor: pointer;
          color: #f13a3a;
          font-size: 15px;
          font-family: '宋体';
          display: flex;
          justify-content: center;
          align-items: center;
          margin-top: 50px;
          margin-left: -220px;
          transition: all 0.3s;
        }
      }
    }
    .conter-right {
      position: absolute;
      width: 632px;
      height: 358px;
      right: 0;
      top: 50%;
      transform: translateY(-50%);
      overflow: hidden;
      img {
        width: 100%;
        height: 100%;
        transition: all 0.3s;
      }
    }
  }
  .activity_right {
    position: relative;
    margin: auto;
    padding-top: 50%;
    box-sizing: border-box;
    .bgc {
      position: absolute;
      width: 80%;
      height: 769px;
      background-color: rgba(241, 58, 58, 0.7);
      right: 0;
      top: 0;
      z-index: 2;
    }
    .conter {
      width: 1200px;
      height: 590px;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      position: absolute;
      z-index: 10;
      display: flex;
      &:hover {
        .conter-right {
          img {
            transform: scale(1.1);
          }
        }
        .conter-left {
          .content {
            .more {
              margin-top: 20px !important;
            }
          }
        }
      }
      .conter-left {
        // background-color: rgba(241, 58, 58, 0.7);
        background-color: transparent;
        width: 1100px;
        position: relative;
        // right: 0;
        .content {
          position: absolute;
          right: -100px;
          width: 475px;
          margin-top: 150px;
          // margin-left: 60px;
          color: #fff;
          transition: all 0.3s;
          .tit {
            font-size: 26px;
            font-family: '宋体';
            font-weight: 600;
          }
          .titE {
            font-size: 14px;
            margin: 20px 0 30px;
          }
          .des {
            font-size: 14px;
            line-height: 2.5em;
            font-family: '微软雅黑';
            color: #ffffffc5;
            transition: all 0.3s;
          }
          .more {
            width: 146px;
            height: 50px;
            background-color: #fff;
            cursor: pointer;
            color: #f13a3a;
            font-size: 15px;
            font-family: '宋体';
            display: flex;
            justify-content: center;
            align-items: center;
            margin-top: 250px;
            margin-left: 0px;
            transition: all 0.3s;
          }
        }
      }
      .conter-right {
        position: absolute;
        width: 632px;
        height: 358px;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        overflow: hidden;
        img {
          width: 100%;
          height: 100%;
          transition: all 0.3s;
        }
      }
    }
  }
}
</style>
